/**
 * Created by yqj on 2017/2/15.
 */
let _Vue = null
const interceptor1 = (request, next) => {
  // continue to next interceptor
  next(function (response) {
    // modify response
    if (response.status !== 200) {
      _Vue.prototype.$message({
        showClose: true,
        message: response.body.message,
        type: 'error'
      })
    } else if (response.status === 403) {
      _Vue.prototype.$message({
        showClose: true,
        message: '会话失效，请重新登录',
        type: 'warning'
      })
    }
  })
}
module.exports = (Vue) => {
  _Vue = Vue
  Vue.http.interceptors.push(interceptor1)
}
